#include<iostream>
using namespace std;
int main(){
    int n;
    while (cin>>n&&n!=-1)
    {
        long long hsum=1,lsum=0,htemp=0,ltemp=0;
        for (int i = 0; i < n; i++)
        {
            htemp=hsum*3;
            ltemp+=hsum;
            ltemp+=lsum;
            htemp+=lsum*2;
            hsum=htemp;
            lsum=ltemp;
            htemp=0;ltemp=0;
        }
        cout<<hsum<<", "<<lsum<<endl;
    }
    
}